<!--
 * @Description  : tabs
 * @Autor        : 杜康
 * @Date         : 2023-03-06 17:25:40 +0800
 * @LastEditors  : 杜康
 * @LastEditTime : 2024-11-05 19:19:27 +0800
-->
<template>
  <el-tabs tab-position="top" class="demo-tabs">
    <el-tab-pane label="参数配置">
      <el-form class="param-form" :model="paramForm" label-width="auto" style="max-width: 600px">
        <el-form-item label="匹配条数">
          <el-slider v-model="paramForm.matches" show-input />
        </el-form-item>
        <el-form-item label="上下文关联条数">
          <el-slider v-model="paramForm.contextCorrelation" show-input />
        </el-form-item>
        <el-form-item label="对话温度">
          <el-slider v-model="paramForm.dialogueTemperature" show-input />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSave">保存</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-tab-pane>
    <el-tab-pane label="围栏配置">
      <el-form :inline="true" :model="formInline">
        <el-form-item label="关键词">
          <el-input v-model="formInline.user" placeholder="请输入关键词" clearable />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
          <el-button type="success" @click="onQuery">新增</el-button>
        </el-form-item>
      </el-form>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="date" label="Date" width="180" />
        <el-table-column prop="name" label="Name" width="180" />
        <el-table-column prop="address" label="Address" />
      </el-table>
      <div class="pagination">
        <el-pagination
          v-model:current-page="currentPage"
          v-model:page-size="pageSize"
          :page-sizes="[100, 200, 300, 400]"
          :size="size"
          background
          layout="total, sizes, prev, pager, next"
          :total="400"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-tab-pane>
  </el-tabs>
</template>
<script setup>
import { ref } from "vue";

const paramForm = ref({
  matches: 20,
  contextCorrelation: 50,
  dialogueTemperature: 30
});

const formInline = ref({
  user: ""
});

const onSave = () => {
  console.log("save!");
};

const onSubmit = () => {
  console.log("submit!");
};
const tableData = ref([
  {
    date: "2016-05-03",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  },
  {
    date: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles"
  }
]);

const onQuery = () => {
  console.log("query!");
};

const currentPage = ref(4);
const pageSize = ref(100);

const handleSizeChange = (val) => {
  console.log(`${val} items per page`);
};
const handleCurrentChange = (val) => {
  console.log(`current page: ${val}`);
};
</script>

<style lang="scss" scoped>
.demo-tabs {
  position: relative;
}
.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: end;
}
</style>
